package com.awx.client.navigation;

import javax.swing.JInternalFrame;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;

import com.awx.client.widget.form.VerticalLayout;

public abstract class AwxWindow extends JInternalFrame implements InternalFrameListener {

	private AwxController controller;

	public AwxWindow() {
		this.setClosable( true );
		this.setMaximizable( true );
		this.setIconifiable( true );
		this.addInternalFrameListener( this );
		this.setDefaultCloseOperation( HIDE_ON_CLOSE );
		this.setLayout( new VerticalLayout() );
	}

	/**
	 * Called before the window is set visible
	 */
	public void onBeforeShow() {
	}

	/**
	 * Called inmediatly after the window become visible
	 */
	public void onShow() {
	}

	/**
	 * Called when the window has been hidden
	 */
	public void onHide() {
	}

	protected AwxController getController() {
		return controller;
	}

	protected void setController(AwxController controller) {
		this.controller = controller;
	}


	public void internalFrameClosed(InternalFrameEvent e) {
		this.getController().windowHidden( this );

	}


	public void internalFrameActivated(InternalFrameEvent e) {
	}
	public void internalFrameClosing(InternalFrameEvent e) {
	}
	public void internalFrameDeactivated(InternalFrameEvent e) {
	}
	public void internalFrameDeiconified(InternalFrameEvent e) {
	}
	public void internalFrameIconified(InternalFrameEvent e) {
	}
	public void internalFrameOpened(InternalFrameEvent e) {
	}


}
